package cn.faifai.tagapi.enums;

public enum PreDeleteStatus {
    NOT_IN_RECYCLE_BIN(0, "未收入回收站"),
    IN_RECYCLE_BIN(1, "已收入回收站"),
    SUSPECT_RESTORED(2, "怀疑已还原"),
    SUSPECT_PERMANENTLY_DELETED(3, "怀疑已永久删除");

    private final int code;
    private final String description;

    PreDeleteStatus(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    @Override
    public String toString() {
        return String.format("PreDeleteStatus{code=%d, description='%s'}", code, description);
    }

    /**
     * 根据状态码查找对应的枚举实例。
     */
    public static PreDeleteStatus fromCode(int code) {
        for (PreDeleteStatus status : values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown code: " + code);
    }
}
